<template>
  <div class="table-container">
    <div>
      <span class="spot"></span>
      <span>{{ spot || '信息详情' }}</span>
    </div>
    <div class="add" @click="showDialog" v-show="title">
      <span>+</span>
      <span>{{ title || '新增菜单' }}</span>
    </div>
  </div>
</template>
<script lang="ts">
// 具体用法查看官方API:https://github.com/kaorun343/vue-property-decorator
import { Component, Vue, Watch, Prop } from 'vue-property-decorator'
@Component({
  name: 'titleContainer',
  components: {
    //引用的组件在这里声明
  }
})
export default class extends Vue {
  @Prop({ default: '' }) private spot!: string
  @Prop({ default: '' }) private title!: string
  private showDialog() {
    this.$emit('add')
  }
}
</script>
<style lang="scss">
.table-container {
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  font-size: 18px;
  font-weight: 600;
  position: relative;
  .spot {
    border: 1px solid #000;
    margin-right: 5px;
    height: 18px;
    overflow: hidden;
  }
  .add {
    color: #e7447d;
    font-size: 14px;
    cursor: pointer;
  }
  .add:hover {
    opacity: 0.8;
  }
}
</style>
